package com.examination.system.administrato;


import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

class Phome {
    public  synchronized  void sendEmail() throws Exception{
        //暂停4秒
        TimeUnit.SECONDS.sleep(4);
        System.out.println("************sendEmail");
    }
    public synchronized void  sendSMS() throws Exception{
        System.out.println("*****************sendSms");
    }

    public void sayHello() throws Exception{
        System.out.println("*******************sayHello");
    }
}

/**
 * @author 寇淇芮
 * @Date 2019/10/12 22:58
 */
public class SaleTicketDemo04 {
    public static void main(String[] args) throws InterruptedException {
         Phome phome = new Phome();
         new Thread(()->{
             try {
                 phome.sendEmail();
             } catch (Exception e) {
                 e.printStackTrace();
             }
         },"A").start();
         Thread.sleep(100);
         new Thread(()->{
             try {
               //  phome.sendSMS();
                 phome.sayHello(); 
             } catch (Exception e) {
                 e.printStackTrace();
             }
         },"B").start();
    }
}
